import { NextPage } from 'next'
import { AppProps } from 'next/app'
import { ReactElement, ReactNode, useEffect } from 'react'
import './index.css'
type NextPageWithLayout = NextPage & {
  getLayout?: (page: ReactElement) => ReactNode
  // title?: string
  // description?: string
}

type AppPropsWithLayout = AppProps & {
  Component: NextPageWithLayout
}

export default function App({ Component, pageProps }: AppPropsWithLayout) {
  const getLayout = Component.getLayout ?? ((page) => page)
  // useEffect(() => {
  //   if (Component.title) {
  //     document.title = Component.title
  //   }
  // }, [])
  return getLayout(<Component {...pageProps} />)
}
